package com.xiaoyudeguang.model;

import com.baomidou.mybatisplus.annotation.TableField;
import com.fasterxml.jackson.annotation.JsonIgnore;
import com.fasterxml.jackson.annotation.JsonInclude;
import com.fasterxml.jackson.databind.node.ObjectNode;
import com.xiaoyudeguang.handler.ObjectNodeTypeHandler;
import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.EqualsAndHashCode;
import lombok.NoArgsConstructor;

import javax.persistence.Column;
import javax.persistence.MappedSuperclass;

/**
 * @author 赵光
 */
@Data
@MappedSuperclass
@NoArgsConstructor
@AllArgsConstructor
@EqualsAndHashCode(callSuper = false)
@JsonInclude(JsonInclude.Include.NON_NULL)
public class Model<T extends Model<?>> extends com.baomidou.mybatisplus.extension.activerecord.Model<T> {

    @JsonIgnore
    @TableField(typeHandler = ObjectNodeTypeHandler.class)
    @Column(nullable = false, columnDefinition = "json comment '扩展字段'")
    private ObjectNode json;
}
